<?php
session_start();
include "validator.php";



$validator = new Validator;

?>
<html><head>
    <meta charset="UTF-8">
    <title>wizzard 2/4</title>
</head>



<?php
if (isset($_POST[height])){
    
    
    if(empty($_POST[height])){
        $report["height"] = "Vyplňte výšku";
    }
    if(empty($_POST[weight])){
        $report["weight"] = "Vyplňte váhu";
    }
    if(empty($_POST[beer])){
        $report["beer"] = "Vyplňte počet piv";
    }
    if(!is_numeric($_POST[height])){
        $report["height2"]= "chybné použití znaků."  ;
    }
     if(!is_numeric($_POST[weight])){
        $report["weight2"]= "chybné použití znaků.";
    }
     if(!is_numeric($_POST[beer])){
        $report["beer2"]= "chybné použití znaků.";
    }
     if(empty($report))
    {
      $vaha =  $_POST[weight] ;
      $vyska = $_POST[height] ;
      $pivo = $_POST[beer];
        $_SESSION["height"] = $vyska  ;
        $_SESSION["weight"] =$vaha;
        $_SESSION["beer"] =  $pivo;
        
       // foreach($_SESSION as $s)
        //echo $s;
        //echo "post" ;
       // foreach($_POST as $p)
       // echo $p;
        
        
        ?>
        <meta http-equiv="refresh" content="0;url=http://databaze.fbmi.cvut.cz/suchapa3/bitwa2/cv8/wizzard3.php">
        <?  
    }
    else
    {
        foreach ($report as $r){
            echo $r . "<br>"; }
            ?>
        <meta http-equiv="refresh" content="0;url=http://databaze.fbmi.cvut.cz/suchapa3/bitwa2/cv8/wizzard2.php">
        <?php
    }
  //  echo "blabla";
 
}
?>
</html>